//
//  YCToolBarView.swift
//  weiBoSwift
//
//  Created by 刘胤辰 on 16/7/24.
//  Copyright © 2016年 it.com. All rights reserved.
//

import UIKit

class YCToolBarView: UIView {

    //数据源
//    var status : YCHomeStatus?{
//        didSet{
//            
//            
//        }
//    }
    
    
    override init(frame: CGRect) {
        
        super.init(frame:frame)
        backgroundColor=UIColor.whiteColor()
        
        //添加
        addSubview(passSendBtn)
        addSubview(discussBtn)
        addSubview(goodBtn)
        addSubview(lineLeftView)
        addSubview(lineRightView)
        //设置约束
        passSendBtn.snp_makeConstraints { (make) -> Void in
            
            make.leading.top.bottom.equalTo(self)
        }
        discussBtn.snp_makeConstraints { (make) -> Void in
            
            make.top.bottom.equalTo(self)
            make.leading.equalTo(passSendBtn.snp_trailing)
            make.width.equalTo(passSendBtn.snp_width)
        }
        goodBtn.snp_makeConstraints { (make) -> Void in
            
            make.top.bottom.equalTo(self)
            make.leading.equalTo(discussBtn.snp_trailing)
            make.trailing.equalTo(self.snp_trailing)
            make.width.equalTo(discussBtn.snp_width)

        }
        lineLeftView.snp_makeConstraints { (make) -> Void in
            
            make.centerX.equalTo(passSendBtn.snp_trailing)
            make.bottom.equalTo(self).offset(-marginW)
            make.top.equalTo(self).offset(marginW)
            make.width.equalTo(1)
            
        }
        lineRightView.snp_makeConstraints { (make) -> Void in
            
            make.centerX.equalTo(discussBtn.snp_trailing)
            make.bottom.equalTo(self).offset(-marginW)
            make.top.equalTo(self).offset(marginW)
            make.width.equalTo(1)
            
        }
//＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝此处有bug，原因不知道，是约束的问题
//        self.snp_makeConstraints { (make) -> Void in
//            
//            make.bottom.equalTo(goodBtn.snp_bottom).offset(marginW)
//        }
    }
    
    // MARK: -- 懒加载控件
    lazy var passSendBtn:UIButton = UIButton(title: "转发", titleColor: UIColor.blackColor(), font: 15)
    lazy var discussBtn:UIButton = UIButton(title: "评论", titleColor: UIColor.blackColor(), font: 15)
    lazy var goodBtn:UIButton = UIButton(title: "赞", titleColor: UIColor.blackColor(), font: 15)
    //中间两条细线
    lazy var lineLeftView:UIView = {
        
        let line=UIView()
        
        line.backgroundColor=UIColor.lightGrayColor()
        
        return line
    }()
    lazy var lineRightView:UIView = {
        
        let line=UIView()
        
        line.backgroundColor=UIColor.lightGrayColor()
        
        return line
    }()
   
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
